Possible nutrient data infill from EGRET package

https://github.com/DOI-USGS/EGRET/blob/main/R/readUserDaily.r

https://cran.r-project.org/web/packages/EGRET/vignettes/EGRET.html

library(EGRET)

egret_BWL_N <- read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_BWL_NO31.csv") %>%
  mutate(NO3_mgL_dl = if_else(ConcAve < 0.0015, 0.0015, ConcAve))%>%
  mutate(NO3_mgL_m = if_else(ConcDay_mod < 0.0015, 0.0015, ConcDay_mod))%>%
  mutate(NO3_mgL_i = if_else(is.na(NO3_mgL_dl), NO3_mgL_m, NO3_mgL_dl))%>%
  mutate(date = as.Date(Date))  %>%
  mutate(site="BWL") %>%
  dplyr::select(date, site, NO3_mgL_i, NO3_mgL_dl, NO3_mgL_m) %>%
  dplyr::group_by(date, site) %>%
  summarise(across(everything(), mean, na.rm = TRUE), .groups = "drop")

infill_count <- sum(is.na(read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_BWL_NO31.csv")$ConcAve))
infill_count
## [1] 0
# Create the plot
logQ_plt <- ggplot(egret_BWL_N, aes(x = date)) +
  # Sample data as black points
  geom_point(aes(y = NO3_mgL_dl, color = "Sampled N"), alpha = 0.9) + 
  geom_line(aes(y = NO3_mgL_dl, color = "Sampled N")) +
  # Modeled data as red triangles
  geom_point(aes(y = NO3_mgL_m, color = "Modeled N"), shape = 2, alpha = 0.9) + 
  geom_line(aes(y = NO3_mgL_m, color = "Modeled N"), alpha = 0.9) + 
  scale_color_manual(values = c("Sampled N" = "black", "Modeled N" = "#D62828")) + 
  scale_x_date(date_breaks = "4 months", date_labels = "%b %Y") +  # Set breaks every 4 months
  theme_bw() + labs(title = "BWL NO3") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
logQ_plt

egret_BWL_A <- read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_BWL_NH4.csv") %>%
  mutate(NH4_mgL_dl = if_else(ConcAve < 0.0015, 0.0015, ConcAve))%>%
  mutate(NH4_mgL_m = if_else(ConcDay_mod < 0.0015, 0.0015, ConcDay_mod))%>%
  mutate(NH4_mgL_i = if_else(is.na(NH4_mgL_m), NH4_mgL_m, NH4_mgL_m))%>%
  mutate(date = as.Date(Date))  %>%
    mutate(site="BWL") %>%
  dplyr::select(date, site, NH4_mgL_i, NH4_mgL_dl, NH4_mgL_m) %>%
  dplyr::group_by(date, site) %>%
  summarise(across(everything(), mean, na.rm = TRUE), .groups = "drop")

infill_count <- sum(is.na(read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_BWL_NH4.csv")$ConcAve))
infill_count
## [1] 22
# Create the plot
logQ_plt1 <- ggplot(egret_BWL_A, aes(x = date)) +
  # Sample data as black points
  geom_point(aes(y = NH4_mgL_dl, color = "Sampled N"), alpha = 0.9) + 
  geom_line(aes(y = NH4_mgL_dl, color = "Sampled N")) +
  # Modeled data as red triangles
  geom_point(aes(y = NH4_mgL_m, color = "Modeled N"), shape = 2, alpha = 0.9) + 
  geom_line(aes(y = NH4_mgL_m, color = "Modeled N"), alpha = 0.9) + 
  scale_color_manual(values = c("Sampled N" = "black", "Modeled N" = "#D62828")) + 
  scale_x_date(date_breaks = "4 months", date_labels = "%b %Y") +  # Set breaks every 4 months
  theme_bw() + labs(title = "BWL NH4") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
logQ_plt1

###

egret_BWU_N <- read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_BWU_NO3.csv") %>%
  mutate(NO3_mgL_dl = if_else(ConcAve < 0.0015, 0.0015, ConcAve))%>%
  mutate(NO3_mgL_m = if_else(ConcDay_mod < 0.0015, 0.0015, ConcDay_mod))%>%
  mutate(NO3_mgL_i = if_else(is.na(NO3_mgL_dl), NO3_mgL_m, NO3_mgL_dl))%>%
  mutate(date = as.Date(Date))  %>%
  mutate(site="BWU") %>%
  dplyr::select(date, site, NO3_mgL_i, NO3_mgL_dl, NO3_mgL_m) %>%
  dplyr::group_by(date, site) %>%
  summarise(across(everything(), mean, na.rm = TRUE), .groups = "drop")

infill_count <- sum(is.na(read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_BWU_NO3.csv")$ConcAve))
infill_count
## [1] 4
# Create the plot
logQ_plt2 <- ggplot(egret_BWU_N, aes(x = date)) +
  # Sample data as black points
  geom_point(aes(y = NO3_mgL_dl, color = "Sampled N"), alpha = 0.9) + 
  geom_line(aes(y = NO3_mgL_dl, color = "Sampled N")) +
  # Modeled data as red triangles
  geom_point(aes(y = NO3_mgL_m, color = "Modeled N"), shape = 2, alpha = 0.9) + 
  geom_line(aes(y = NO3_mgL_m, color = "Modeled N"), alpha = 0.9) + 
  scale_color_manual(values = c("Sampled N" = "black", "Modeled N" = "#D62828")) + 
  scale_x_date(date_breaks = "4 months", date_labels = "%b %Y") +  # Set breaks every 4 months
  theme_bw() + labs(title = "BWU NO3") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
logQ_plt2

egret_BWU_A <- read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_BWU_NH4.csv") %>%
  mutate(NH4_mgL_dl = if_else(ConcAve < 0.0015, 0.0015, ConcAve))%>%
  mutate(NH4_mgL_m = if_else(ConcDay_mod < 0.0015, 0.0015, ConcDay_mod))%>%
  mutate(NH4_mgL_i = if_else(is.na(NH4_mgL_m), NH4_mgL_m, NH4_mgL_m))%>%
  mutate(date = as.Date(Date))  %>%
    mutate(site="BWU") %>%
  dplyr::select(date, site, NH4_mgL_i, NH4_mgL_dl, NH4_mgL_m) %>%
  dplyr::group_by(date, site) %>%
  summarise(across(everything(), mean, na.rm = TRUE), .groups = "drop")

infill_count <- sum(is.na(read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_BWU_NH4.csv")$ConcAve))
infill_count
## [1] 5
# Create the plot
logQ_plt3 <- ggplot(egret_BWU_A, aes(x = date)) +
  # Sample data as black points
  geom_point(aes(y = NH4_mgL_dl, color = "Sampled N"), alpha = 0.9) + 
  geom_line(aes(y = NH4_mgL_dl, color = "Sampled N")) +
  # Modeled data as red triangles
  geom_point(aes(y = NH4_mgL_m, color = "Modeled N"), shape = 2, alpha = 0.9) + 
  geom_line(aes(y = NH4_mgL_m, color = "Modeled N"), alpha = 0.9) + 
  scale_color_manual(values = c("Sampled N" = "black", "Modeled N" = "#D62828")) + 
  scale_x_date(date_breaks = "4 months", date_labels = "%b %Y") +  # Set breaks every 4 months
  theme_bw() + labs(title = "BWU NH4") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
logQ_plt3

###

egret_GBL_N <- read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_GBL_NO3.csv") %>%
  mutate(NO3_mgL_dl = if_else(ConcAve < 0.0015, 0.0015, ConcAve))%>%
  mutate(NO3_mgL_m = if_else(ConcDay_mod < 0.0015, 0.0015, ConcDay_mod))%>%
  mutate(NO3_mgL_i = if_else(is.na(NO3_mgL_dl), NO3_mgL_m, NO3_mgL_dl))%>%
  mutate(date = as.Date(Date))  %>%
  mutate(site="GBL") %>%
  dplyr::select(date, site, NO3_mgL_i, NO3_mgL_dl, NO3_mgL_m) %>%
  dplyr::group_by(date, site) %>%
  summarise(across(everything(), mean, na.rm = TRUE), .groups = "drop")

infill_count <- sum(is.na(read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_GBL_NO3.csv")$ConcAve))
infill_count
## [1] 8
# Create the plot
logQ_plt4 <- ggplot(egret_GBL_N, aes(x = date)) +
  # Sample data as black points
  geom_point(aes(y = NO3_mgL_dl, color = "Sampled N"), alpha = 0.9) + 
  geom_line(aes(y = NO3_mgL_dl, color = "Sampled N")) +
  # Modeled data as red triangles
  geom_point(aes(y = NO3_mgL_m, color = "Modeled N"), shape = 2, alpha = 0.9) + 
  geom_line(aes(y = NO3_mgL_m, color = "Modeled N"), alpha = 0.9) + 
  scale_color_manual(values = c("Sampled N" = "black", "Modeled N" = "#D62828")) + 
  scale_x_date(date_breaks = "4 months", date_labels = "%b %Y") +  # Set breaks every 4 months
  theme_bw() + labs(title = "GBL NO3") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
logQ_plt4

egret_GBL_A <- read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_GBL_NH4.csv") %>%
  mutate(NH4_mgL_dl = if_else(ConcAve < 0.0015, 0.0015, ConcAve))%>%
  mutate(NH4_mgL_m = if_else(ConcDay_mod < 0.0015, 0.0015, ConcDay_mod))%>%
  mutate(NH4_mgL_i = if_else(is.na(NH4_mgL_m), NH4_mgL_m, NH4_mgL_m))%>%
  mutate(date = as.Date(Date))  %>%
    mutate(site="GBL") %>%
  dplyr::select(date, site, NH4_mgL_i, NH4_mgL_dl, NH4_mgL_m) %>%
  dplyr::group_by(date, site) %>%
  summarise(across(everything(), mean, na.rm = TRUE), .groups = "drop")

infill_count <- sum(is.na(read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_GBL_NH4.csv")$ConcAve))
infill_count
## [1] 10
# Create the plot
logQ_plt5 <- ggplot(egret_GBL_A, aes(x = date)) +
  # Sample data as black points
  geom_point(aes(y = NH4_mgL_dl, color = "Sampled N"), alpha = 0.9) + 
  geom_line(aes(y = NH4_mgL_dl, color = "Sampled N")) +
  # Modeled data as red triangles
  geom_point(aes(y = NH4_mgL_m, color = "Modeled N"), shape = 2, alpha = 0.9) + 
  geom_line(aes(y = NH4_mgL_m, color = "Modeled N"), alpha = 0.9) + 
  scale_color_manual(values = c("Sampled N" = "black", "Modeled N" = "#D62828")) + 
  scale_x_date(date_breaks = "4 months", date_labels = "%b %Y") +  # Set breaks every 4 months
  theme_bw() + labs(title = "GBL NH4") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
logQ_plt5

###

egret_GBU_N <- read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_GBU_NO3.csv") %>%
  mutate(NO3_mgL_dl = if_else(ConcAve < 0.0015, 0.0015, ConcAve))%>%
  mutate(NO3_mgL_m = if_else(ConcDay_mod < 0.0015, 0.0015, ConcDay_mod))%>%
  mutate(NO3_mgL_i = if_else(is.na(NO3_mgL_dl), NO3_mgL_m, NO3_mgL_dl))%>%
  mutate(date = as.Date(Date))  %>%
  mutate(site="GBU") %>%
  dplyr::select(date, site, NO3_mgL_i, NO3_mgL_dl, NO3_mgL_m) %>%
  dplyr::group_by(date, site) %>%
  summarise(across(everything(), mean, na.rm = TRUE), .groups = "drop")

infill_count <- sum(is.na(read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_GBU_NO3.csv")$ConcAve))
infill_count
## [1] 11
# Create the plot
logQ_plt6 <- ggplot(egret_GBU_N, aes(x = date)) +
  # Sample data as black points
  geom_point(aes(y = NO3_mgL_dl, color = "Sampled N"), alpha = 0.9) + 
  geom_line(aes(y = NO3_mgL_dl, color = "Sampled N")) +
  # Modeled data as red triangles
  geom_point(aes(y = NO3_mgL_m, color = "Modeled N"), shape = 2, alpha = 0.9) + 
  geom_line(aes(y = NO3_mgL_m, color = "Modeled N"), alpha = 0.9) + 
  scale_color_manual(values = c("Sampled N" = "black", "Modeled N" = "#D62828")) + 
  scale_x_date(date_breaks = "4 months", date_labels = "%b %Y") +  # Set breaks every 4 months
  theme_bw() + labs(title = "GBU NO3") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
logQ_plt6

egret_GBU_A <- read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_GBU_NH4.csv") %>%
  mutate(NH4_mgL_dl = if_else(ConcAve < 0.0015, 0.0015, ConcAve))%>%
  mutate(NH4_mgL_m = if_else(ConcDay_mod < 0.0015, 0.0015, ConcDay_mod))%>%
  mutate(NH4_mgL_i = if_else(is.na(NH4_mgL_m), NH4_mgL_m, NH4_mgL_m))%>%
  mutate(date = as.Date(Date))  %>%
    mutate(site="GBU") %>%
  dplyr::select(date, site, NH4_mgL_i, NH4_mgL_dl, NH4_mgL_m) %>%
  dplyr::group_by(date, site) %>%
  summarise(across(everything(), mean, na.rm = TRUE), .groups = "drop")

infill_count <- sum(is.na(read.csv("/Users/kellyloria/Documents/Publications/CH1\ biogeochem\ linkages/EGRET_GBU_NH4.csv")$ConcAve))
infill_count
## [1] 12
# Create the plot
logQ_plt7 <- ggplot(egret_GBU_A, aes(x = date)) +
  # Sample data as black points
  geom_point(aes(y = NH4_mgL_dl, color = "Sampled N"), alpha = 0.9) + 
  geom_line(aes(y = NH4_mgL_dl, color = "Sampled N")) +
  # Modeled data as red triangles
  geom_point(aes(y = NH4_mgL_m, color = "Modeled N"), shape = 2, alpha = 0.9) + 
  geom_line(aes(y = NH4_mgL_m, color = "Modeled N"), alpha = 0.9) + 
  scale_color_manual(values = c("Sampled N" = "black", "Modeled N" = "#D62828")) + 
  scale_x_date(date_breaks = "4 months", date_labels = "%b %Y") +  # Set breaks every 4 months
  theme_bw() + labs(title = "GBL NH4") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
logQ_plt7

nitrogen_dat <- rbind(egret_BWL_N,
                      egret_BWU_N, 
                      egret_GBL_N, 
                      egret_GBU_N)

nitrogen_datA <- rbind(egret_BWL_A, 
                      egret_BWU_A,
                      egret_GBL_A, 
                      egret_GBU_A)

nitrogen_data <- nitrogen_dat %>% full_join(nitrogen_datA, by=c("date", "site"))

Calculate nitrogen demand:

# Constants
ra <- 0.5  # Autotrophic respiration coefficient (Hall & Tank 2003)
C_Nauto <- 16  # Autotrophic C:N ratio (Stelzer & Lamberti 2001)
C_Nhetero <- 20  # Heterotrophic C:N ratio (Hall & Tank 2003)
HGE <- 0.05  # Heterotrophic Growth Efficiency (Hall & Tank 2003)

# Calculate components of nitrogen demand
covariat_ndemand <- covariat_datq %>%
  group_by(site) %>% 
  mutate(
    # Autotrophic respiration (raGPP)
    raGPP = GPP_mean * ra,
    # Autotrophic assimilation of N
    Auto_N_assim = GPP_mean / C_Nauto,
    # Heterotrophic respiration (Rh)
    Rh = ER_mean - raGPP,
    # Heterotrophic assimilation of N
    Hetero_N_assim = (Rh * HGE) / C_Nhetero,
    # Total nitrogen demand
    Ndemand = Auto_N_assim + Hetero_N_assim, # unit should be g N m-2 d-1
    Ndemand = if_else(Ndemand < 0, 0.0001, Ndemand)) %>%
  dplyr::select(site, date, Ndemand)

Quality check on supply calculations:

  1. How many data points do we have for velocity (v) and width (w)?

## # A tibble: 4 × 3
##   site  w_m_count v_m_count
##   <chr>     <int>     <int>
## 1 BWL          33        33
## 2 BWU          15        15
## 3 GBL          39        39
## 4 GBU          29        29

better way to infill width and velocites to get at reach length:

na.approx, and using Q as “Variables to be used for interpolation as in”

covariat_datqI <- covariat_datq %>%
  group_by(site) %>%
  arrange(date) %>%
  mutate(
    # Fit a linear model for w_m ~ Q_m using non-missing values
    w_m_apr = ifelse(is.na(w_m), predict(lm(w_m ~ depth_m, data = cur_data(), na.action = na.omit), newdata = cur_data()), w_m),
    v_m_apr = ifelse(is.na(v_m), predict(lm(v_m ~ Q_m, data = cur_data(), na.action = na.omit), newdata = cur_data()), v_m)
  ) %>%
  ungroup()

covariat_datqI <- covariat_datqI %>%
  group_by(site) %>%
  arrange(date) %>%  # Ensure chronological order
   mutate( ## 17 NAs
    w_m_apr = ifelse(is.na(w_m_apr),
                  rollapplyr(w_m_apr, width = 15, FUN = function(x) mean(x, na.rm = TRUE), fill = NA, partial = TRUE),
                  w_m_apr),
    v_m_apr = ifelse(is.na(v_m_apr),
                  rollapplyr(v_m_apr, width = 15, FUN = function(x) mean(x, na.rm = TRUE), fill = NA, partial = TRUE),
                  v_m_apr))

Where the black points are the survey measures of width or velocity.

Calculate nitrogen supply:

covariat_nsupply <- covariat_datqI %>%
  left_join(nitrogen_data, by=c("date", "site")) %>%
  dplyr::select(site, catch, date, water_year, reach_length,
                v_m_apr,w_m_apr, Q_m, K600_daily_mean,
                NO3_mgL_dl_sw, NH4_mgL_dl_sw, PO4_ugL_dl_sw, NO3_mgL_i, NH4_mgL_i) %>%
  mutate(
    K600_daily_mean = case_when(
      is.na(K600_daily_mean) & site == "BWL" ~ 22, 
      is.na(K600_daily_mean) & site == "BWU" ~ 16,
      is.na(K600_daily_mean) & site == "GBU" ~ 32,
      is.na(K600_daily_mean) & site == "GBL" ~ 25,
      TRUE ~ K600_daily_mean)) %>%
  mutate(Q_Ls = Q_m * 1000, # flow from csm to Ls
  # calculate reach length in m
  reachL = c((v_m_apr*w_m_apr*8640)/K600_daily_mean), # seconds to days
   # Calculate no3 supply 
  NO3_supply = c(((86400*Q_Ls*(NO3_mgL_dl_sw/1000))/(w_m_apr*reachL))),
  NO3_supply_new = c(((86400*Q_Ls*(NO3_mgL_i/1000))/(w_m_apr*reachL))),

   # Calculate nh3 supply 
  NH4_supply = c(((86400*Q_Ls*(NH4_mgL_dl_sw/1000))/(w_m_apr*reachL))), ## unit should be g N m-2 d-1
 NH4_supply_new = c(((86400*Q_Ls*(NH4_mgL_i/1000))/(w_m_apr*reachL))),
  PO4_supply = c(((86400*Q_Ls*(PO4_ugL_dl_sw/1e-6))/(w_m_apr*reachL))) ## unit should be g N m-2 d-1
   )  %>%
  dplyr::select(site, date, reachL, reach_length, Q_Ls, NO3_supply, 
                NO3_supply_new, NH4_supply, PO4_supply, NH4_supply_new, NO3_mgL_i, NH4_mgL_i)

As a follow up… Which type of reach length works best?

I think the empirical calculation as K600 remained similar across flows.

But - Covino et al picked a static length:

“…Our experimental stream reach was near the Wooden Bridge in the Korstian Division and stretched 175 and 200 m up- and downstream, respectively.. We used a stream length of 100 m (King et al. 2014). Ideal estimates of supply to the stream bed would exceed the stream length over which the water column mixes vertically and, therefore, solutes would be available to the bed, but we lacked hydrodynamic information to estimate this length…”

Here I chose to estimate instead estimate reach length based off Laurel’s advice for using the gas exchange estimates to get estimate theoretic reach length. Where reach length = velocity (m s^-1) * width (in m) / gas exchange (m day^-1).

But the empirical RL is calculated across the entire non- trimmed time sieries of flow so does have some outliers at peak flows. Often when we weren’t sampling during those event flows and also couldn’t model metabolism then as well.

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    50.0    75.0   100.0   101.1   100.0   250.0    5196
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max.      NA's 
##     2.948    53.345   181.106   509.444   477.511 12414.389        17

The vertical dotted line is 500 m to help compare ranges with the large range of unrealistic RL at high flows.

Plots of Ratios of NH4+- N supply to demand, ratios NO3– N supply to demand

Remaid figure 4: Now with chemistry data aligned to data data frame so that there are no sample NAs for NO3 and Nh4 when the metabolism model failed to estimate that parameter on the same day as the chemistry sample.

Color is now also by water year 2021-2024, and shape is reach location.

Nitrogen Uptake dynamics from TASCC

n_df <- n_up%>%
  filter(success=="yes") %>%
  mutate(
         Uadd_g_m2_min = c(Uadd_ug_L_min/1000000),
         Uadd_g_m2_D = c(Uadd_g_m2_min*1440),
         Vf_mm_min=c(Vf_m_min)*1000) 

uptake <- n_df %>%
  pivot_wider(
    names_from = method, 
    values_from = Uadd_g_m2_D, 
    names_prefix = "Uadd_g_m2_D_") %>%
  dplyr::select(site, date, Uadd_g_m2_D_NH3, Uadd_g_m2_D_NO3)


uptake2 <- n_df %>%
  pivot_wider(
    names_from = method, 
    values_from = c(Uadd_g_m2_D, Vf_mm_min)
  ) 
summary(uptake)
##      site                date            Uadd_g_m2_D_NH3    Uadd_g_m2_D_NO3   
##  Length:53          Min.   :2022-04-07   Min.   :0.003370   Min.   :0.001037  
##  Class :character   1st Qu.:2022-10-03   1st Qu.:0.009677   1st Qu.:0.004990  
##  Mode  :character   Median :2023-03-27   Median :0.020218   Median :0.010238  
##                     Mean   :2023-02-16   Mean   :0.031153   Mean   :0.014882  
##                     3rd Qu.:2023-07-18   3rd Qu.:0.036850   3rd Qu.:0.020261  
##                     Max.   :2023-09-25   Max.   :0.174442   Max.   :0.069293  
##                                          NA's   :26         NA's   :27
uptake_df <-  covariat_NS_ND%>%
  full_join(uptake)

Linking ecosystem funtion and biogeochemical dynamics:

We found that autotrophic production (and so nitrogen demand) is suppressed in wetter years. We want to know how the reduced autrophic production could effect nitrogen retention and transport.

  • To estimate what amount of the nitrogen can be could be transformed via uptake in at a given reach?

    • Fractional uptake efficiencies (FUE) for N?

    • Might consider the FUE at the lower station as downstream export?

  • To estimate what amount of the nitrogen can be could be transformed via uptake in a stream

    • Difference in FUE between reaches for overall stream processing?
  • In wet years, even though supply increases, we would expect biological processes like uptake to decrease. So what percent of the N supply is either processes or exported in wet verse dry years?

Consider the units
  • Areal max uptake - Ut - ug / m2 min -> we converted to g m2 day

  • Uptake velocity - Vf - m / min

  • Uptake length - Sw - m

  • Supply and demand is in g N m-2 d-1

New analysis of Nitrogen dynamics:

Methods for evaluating nitrogen cycling

According to Covino et al. 2018 :

  • Supply (S): The available nitrogen in the system (in g N/m²/day).

  • Demand (D): The total biological nitrogen demand (in g N/m²/day).

  • Uptake rate (U): The amount of nitrogen removed from the water column via assimilation, denitrification, or other biological processes.

U = (D * S) / (D + S)

  • When demand (D) is much greater than supply (S): Almost all available nitrogen is taken up, so uptake approaches supply (U ≈ S)

  • When supply (S) is much greater than demand (D): Uptake is limited by biological demand, and uptake approaches demand (U ≈ D)

##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's 
##     0.01     0.24     5.33  2704.61   825.49 92946.88     5136
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max.      NA's 
##     0.013     0.166     4.223   898.541   336.079 28387.552      5144
##          10%          90% 
## 5.381194e-02 5.529456e+03
##          10%          90% 
## 4.322134e-02 1.607634e+03

Supply and demand dynamics tend to vary with catchment and reach:

Looks like N supply is greater than demand at GB – indicating that uptake (U) should be low and possibly limited by low biologic demand. So we expect more nitrogen to be transported in GB.

Looks Like N demand is greater than supply at BW – U should be high and most available nitrogen should be retained.

Uptake (U) approaches supply at BW (U ≈ S; plots a & c). This is less true for GB where supply is greater than uptake (U < S) indicating something other than supply is limiting biologic uptake at GB.

Similarly, U ≈ D at GB (plots b & d), providing additional evidence that uptake is more limited by biological demand, relative to N supply.

Looking at specific events based on the 75th quantile?

Identify High N Demand Events 2021-2023

## # A tibble: 4 × 6
##   site  count mean_Ndemand max_Ndemand earliest_date latest_date
##   <chr> <int>        <dbl>       <dbl> <date>        <date>     
## 1 BWL     257       0.166       0.365  2021-05-20    2024-08-15 
## 2 BWU     150       0.182       0.645  2021-07-01    2023-10-24 
## 3 GBU      21       0.0559      0.0846 2021-06-03    2022-09-24 
## 4 GBL      11       0.0700      0.168  2021-05-14    2024-03-26

Identify High NO3 supply Events 2021-2023

## # A tibble: 2 × 6
##   site  count mean_NO3_supply max_NO3_supply earliest_date latest_date
##   <chr> <int>           <dbl>          <dbl> <date>        <date>     
## 1 GBL      19           0.824           3.27 2021-06-10    2023-09-18 
## 2 GBU      14           1.07            2.20 2021-05-18    2023-09-18

Identify High NH4 supply Events 2021-2023

## # A tibble: 3 × 6
##   site  count mean_NH4_supply max_NH4_supply earliest_date latest_date
##   <chr> <int>           <dbl>          <dbl> <date>        <date>     
## 1 GBL      11           0.359          0.627 2021-06-23    2023-08-02 
## 2 GBU      11           0.588          2.84  2022-05-19    2023-08-30 
## 3 BWU       1           0.262          0.262 2023-01-28    2023-01-28

Plot daily demand and suppply 2021-2023

Dashed horizontal lines are the 75th quantile of each response.

Demand highest in 2021 and typically peaks in fall. Supply for NH4 or NO3 appears to be low in 2021, with slight elevation in 2023. Supply for either N is typically higher at GB relative to BW.

Fractional uptake efficiency for each nitrogen type:

A value close to 1 suggests high efficiency, meaning most of the supplied nitrogen was absorbed, while a value close to 0 suggests that most of the supplied nitrogen remained in the system

Summary of fractional uptake of N from dry to wet years

## # A tibble: 8 × 10
## # Groups:   site [4]
##   site  WY_lab frac_NO3_uptake frac_NH4_uptake frac_N_uptake N_demand NO3_supply
##   <chr> <chr>            <dbl>           <dbl>         <dbl>    <dbl>      <dbl>
## 1 BWL   dry           0.790           0.832         0.988    0.150        0.0756
## 2 BWL   wet           0.425           0.391       NaN        0.0297       0.0678
## 3 BWU   dry           0.818           0.788         0.774    0.187        0.139 
## 4 BWU   wet           0.265           0.394         0.306    0.0330       0.100 
## 5 GBL   dry           0.000201        0.00135       0.000350 0.00363      0.270 
## 6 GBL   wet           0.000154        0.000467      0.000230 0.00425      0.766 
## 7 GBU   dry           0.0421          0.0755        0.0504   0.00926      0.287 
## 8 GBU   wet           0.0203          0.0192        0.0197   0.000588     1.56  
## # ℹ 3 more variables: NH4_supply <dbl>, NO3_mgL <dbl>, NH4_mgL <dbl>

Percent change in FUE by reach for NO3, NH4, and total N (NO3+NH4) from dry to wet years

## # A tibble: 4 × 9
## # Groups:   site [4]
##   site  pct_FUE_NO3 pct_FUE_NH4 pct_FUE_N pct_demand pct_NO3_supply
##   <chr>       <dbl>       <dbl>     <dbl>      <dbl>          <dbl>
## 1 BWL         -46.1       -52.9     NaN        -80.2          -10.3
## 2 BWU         -67.6       -50       -60.4      -82.4          -27.8
## 3 GBL         -23.3       -65.5     -34.4       17.1          184  
## 4 GBU         -51.8       -74.5     -61        -93.6          443. 
## # ℹ 3 more variables: pct_NH4_supply <dbl>, pct_NO3 <dbl>, pct_NH4 <dbl>

Fractional uptake efficiency appeared to decrease from dry to wet years for both NO3 NH4.

Nitrogen dynamics within streams from upper to lower reaches:

Looking at possible nitrogen retention with BW or GB:

  • NO₃/NH₄ retention fraction close to 1: Most nitrogen is processed/retained before reaching the lower reach.

  • NO₃/NH₄ retention fraction close to 0: Most nitrogen passes downstream unchanged.

  • Negative retention values: suggest an increase in nitrogen downstream, possibly from inputs like tributaries or groundwater

##     catch                date            NO3_supply_upper NO3_supply_lower
##  Length:2602        Min.   :2021-03-20   Min.   :0.0024   Min.   :0.0017  
##  Class :character   1st Qu.:2022-02-08   1st Qu.:0.0311   1st Qu.:0.0262  
##  Mode  :character   Median :2022-12-30   Median :0.1017   Median :0.1103  
##                     Mean   :2022-12-30   Mean   :0.3516   Mean   :0.2425  
##                     3rd Qu.:2023-11-20   3rd Qu.:0.3273   3rd Qu.:0.2822  
##                     Max.   :2024-10-10   Max.   :9.2947   Max.   :3.2674  
##                                          NA's   :2469     NA's   :2490    
##  NH4_supply_upper NH4_supply_lower  U_NO3_upper      U_NO3_lower    
##  Min.   :0.0017   Min.   :0.0020   Min.   :0.0001   Min.   :0.0001  
##  1st Qu.:0.0228   1st Qu.:0.0132   1st Qu.:0.0001   1st Qu.:0.0001  
##  Median :0.1152   Median :0.0271   Median :0.0049   Median :0.0025  
##  Mean   :0.2080   Mean   :0.1047   Mean   :0.0115   Mean   :0.0053  
##  3rd Qu.:0.2556   3rd Qu.:0.1689   3rd Qu.:0.0154   3rd Qu.:0.0062  
##  Max.   :2.8388   Max.   :0.6274   Max.   :0.0798   Max.   :0.0298  
##  NA's   :2536     NA's   :2500     NA's   :2556     NA's   :2580    
##   U_NH4_upper      U_NH4_lower       NO3_upper        NO3_lower     
##  Min.   :0.0001   Min.   :0.0001   Min.   :0.0015   Min.   :0.0015  
##  1st Qu.:0.0001   1st Qu.:0.0001   1st Qu.:0.0050   1st Qu.:0.0040  
##  Median :0.0001   Median :0.0050   Median :0.0115   Median :0.0120  
##  Mean   :0.0066   Mean   :0.0067   Mean   :0.0149   Mean   :0.0151  
##  3rd Qu.:0.0109   3rd Qu.:0.0096   3rd Qu.:0.0225   3rd Qu.:0.0220  
##  Max.   :0.0578   Max.   :0.0325   Max.   :0.0570   Max.   :0.0570  
##  NA's   :2569     NA's   :2575     NA's   :2469     NA's   :2490    
##    NH4_upper        NH4_lower        w_m_upper       w_m_lower     
##  Min.   :0.0024   Min.   :0.0015   Min.   :1.010   Min.   : 0.910  
##  1st Qu.:0.0046   1st Qu.:0.0033   1st Qu.:1.510   1st Qu.: 1.750  
##  Median :0.0063   Median :0.0056   Median :1.845   Median : 2.675  
##  Mean   :0.0085   Mean   :0.0058   Mean   :2.654   Mean   : 4.394  
##  3rd Qu.:0.0123   3rd Qu.:0.0074   3rd Qu.:3.475   3rd Qu.: 6.865  
##  Max.   :0.0220   Max.   :0.0171   Max.   :6.450   Max.   :10.140  
##  NA's   :2536     NA's   :2500     NA's   :2574    NA's   :2554    
##   reach_length    reach_area    NO3_retention     NH4_retention    
##  Min.   :1100   Min.   : 1568   Min.   :-6.9096   Min.   :-7.2117  
##  1st Qu.:1100   1st Qu.: 1786   1st Qu.:-0.0604   1st Qu.:-0.3992  
##  Median :2625   Median : 2002   Median : 0.5204   Median : 0.1279  
##  Mean   :2625   Mean   : 9737   Mean   : 0.0682   Mean   :-0.3898  
##  3rd Qu.:4150   3rd Qu.:20797   3rd Qu.: 0.5702   3rd Qu.: 0.5432  
##  Max.   :4150   Max.   :34051   Max.   : 0.9055   Max.   : 0.9632  
##                 NA's   :2584    NA's   :2494      NA's   :2539     
##  NO3_processed     NH4_processed    NO3_processedi    NH4_processedi   
##  Min.   : -984.4   Min.   :-634.6   Min.   :-37.553   Min.   :-63.725  
##  1st Qu.: -410.0   1st Qu.:-213.1   1st Qu.: -6.691   1st Qu.:-11.357  
##  Median :  332.0   Median :  42.4   Median : -2.167   Median : -5.008  
##  Mean   : 1442.1   Mean   : 553.6   Mean   : -3.252   Mean   :  1.501  
##  3rd Qu.: 1451.7   3rd Qu.: 463.6   3rd Qu.:  5.792   3rd Qu.:  3.191  
##  Max.   :11934.1   Max.   :4417.4   Max.   : 11.825   Max.   :184.831  
##  NA's   :2591      NA's   :2585     NA's   :2591      NA's   :2585     
##       jday      
##  Min.   :  1.0  
##  1st Qu.:101.0  
##  Median :183.0  
##  Mean   :182.8  
##  3rd Qu.:264.0  
##  Max.   :365.0  
## 

Plot daily retention dynamics 2021-2023:

Summarize stream N uptake of N from dry to wet years

## # A tibble: 4 × 6
## # Groups:   catch [2]
##   catch WY_lab NO3_retention NH4_retention NO3_processed NH4_processed
##   <chr> <chr>          <dbl>         <dbl>         <dbl>         <dbl>
## 1 BW    dry           0.509        0.533         NaN             91.2 
## 2 BW    wet           0.294       -0.286         NaN            -36.2 
## 3 GB    dry          -1.08        -1.08           -0.779         -3.95
## 4 GB    wet           0.0364      -0.00421        -5.31           1.29

Percent change in FUE by reach for NO3, NH4, and total N (NO3+NH4) from dry to wet years

## # A tibble: 2 × 5
## # Groups:   catch [2]
##   catch pct_NO3_retention pct_NH4_retention pct_NO3_proc pct_NH4_proc
##   <chr>             <dbl>             <dbl>        <dbl>        <dbl>
## 1 BW                -42.2            -154.          NaN         -140.
## 2 GB               -103.              -99.6         582.        -133.

Final thoughts:

Main points:

  • Overall– across all reaches there is low nitrogen demand, low uptake, and moderate nitrogen supply.

    • Peak nitrogen supply tends to occur ahead of peak demand.

    • Nitrogen supply increased increased from wet to dry years, while nitrogen demand and fractional uptake efficiency (FUE) both decreased.

    • FUE is higher for NH4 relative to NO3

Stream specifics nitrogen dynamics:

  • GB: N supply is greater than demand at GB – indicating that uptake (U) should be low and possibly limited by low biologic demand.

    • FUE also tends to be near 0 at GB

    • There are some negative values of nitrogen retention between upper and lower reaches suggesting some other source of nitrogen is present downstream of GBU (likely groundwater).

    • So we expect more nitrogen to be transported relative to the amount transformed or retained in GB.

  • BW: N demand can be greater than nitrogen supply at BW – U tends to be more related to supply dynamics.

    • FUE tends to be near 1.

    • Most nitrogen retention between upper and lower reaches appears to between 0 and 1 suggesting it could be retained or processed between the upper and lower reaches.

    • Relative to GB, BW can actually process or retain a large portion of the nitrogen concentrations in stream water, despite being a larger stream.

Comparing nitrogen dynamics from dry to wet years?

  • Changes to demand?

    • Demand decreased by 80% at BW, by 93% at GBU and increased by 17% GBL
  • Changes to supply?

    • NO3 : Increased by 16% at BWL, by 184% at GBL, by 442% at GBU, and decreased by 5% at BWU

    • NH4 : Increased by 46% at BWL, by 47% at BWU, by 112 % at GBL, by 244% at GBU

  • Changes to FUE?

    • NO3 : Decreased by 46% at BWL, by 67% at BWU, by 23% at GBL, and by 52% at GBU

    • NH4 : Decreased by 53% at BWL, by 50% at BWU, by 66% at GBL, by 75% at GBU

  • Changes to between reach retention?

    • NO3 : Decreased by 42% at BW, by 103 % at GB
    • NH4 : Decreased by 151% at BW, by 100 % at GB

How do these Vf and U compare to Vicent et al. ?

(Tank et al.?) 0-50 vf so we have estimates above that

0-8 Uadd